import { makeAutoObservable } from 'mobx'
import { getBarriers } from './api'
import type { BarriersListType } from './interface'
class Store {
    sence_id: string = '0'
    barriersList: BarriersListType[] = []
    constructor() {
        makeAutoObservable(this)
    }

    async getBarriersData(id: string) {
        console.log(this.barriersList)
        if (this.barriersList.length > 0) {
            return
        }
        const { data } = await getBarriers(id)
        this.sence_id = data.scene_id
        console.log(data)
        this.barriersList = data.detail
    }

    setSenceId = async (id: string) => {
        this.sence_id = id
    }

    setBarriersList = async (data: BarriersListType[]) => {
        this.barriersList = data
    }
}
const store = new Store()
export default store
